import 'package:amoy_ticket/people/people_main/music_and_movie_card_logic.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';

class MusicAndMovieCardPage extends StatelessWidget {
  const MusicAndMovieCardPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    MusicAndMovieCardLogic logic = Get.put(MusicAndMovieCardLogic());
    return Scaffold(
      appBar: AppBar(
        title: Obx(() => Text(logic.count.toString())),
      ),
      body: Center(
        child: Column(
          children: [
            ElevatedButton(
              onPressed: () {
                Get.to(() => OtherPage());
              },
              child: Text('Go to other page'),
            ),
            ElevatedButton(
              onPressed: () async {
                SmartDialog.showToast(
                    'width:${Get.width},height:${Get.height}');
              },
              child: Text('width and height'),
            ),
            ElevatedButton(
              onPressed: () async {
                SmartDialog.showToast('''
                    width:${Get.context?.width},
                    height:${Get.context?.height},
                    origin:${Get.context?.orientation},
                    devicePixelRatio:${Get.context?.devicePixelRatio}
                    是否为平板设备${Get.context?.isTablet}
                    ''',
                    alignment: Alignment.center,
                    animationTime: Duration(seconds: 3));
              },
              child: Text('get some  info '),
            ),
            ElevatedButton(
              onPressed: () async {
                Get.changeTheme(
                    Get.isDarkMode ? ThemeData.light() : ThemeData.dark());
              },
              child: Text('change theme'),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          logic.increment();
        },
        child: Icon(Icons.add),
      ),
    );
  }
}

class OtherPage extends StatelessWidget {
  const OtherPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    MusicAndMovieCardLogic logic = Get.find<MusicAndMovieCardLogic>();
    return Scaffold(
      appBar: AppBar(
        title: Text(logic.count.toString()),
      ),
    );
  }
}
